package JZ;

import java.util.*;

public class jz13 {
    static int s = 0;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] input = sc.nextLine().split(",");
        int threshold = Integer.parseInt(input[0]);
        int rows = Integer.parseInt(input[1]);
        int cols = Integer.parseInt(input[2]);
        int[][] used = new int[rows][cols];
        int sum = 0;
        dfs(0,0,rows, cols, threshold, used);
        System.out.println(s);
    }
    public static void dfs(int i, int j, int rows, int cols, int threshold, int used[][]){
        int p = i;
        int sum = 0;
        while(p != 0){
            sum += p % 10;
            p = p / 10;
        }
        p = j;
        while(p != 0){
            sum += p % 10;
            p = p / 10;
        }
        if(i >= rows || j >= cols || i <0 || j < 0 || sum > threshold || used[i][j] == 1)
            return;
        else{
            s++;
            used[i][j] = 1;
        }
        dfs(i + 1, j, rows, cols, threshold, used);
        dfs(i - 1, j, rows, cols, threshold, used);
        dfs(i, j + 1, rows, cols, threshold, used);
        dfs(i, j - 1, rows, cols, threshold, used);
    }
}
